package com.m1.tzolkin.model.buildables;

import java.util.Collection;
import java.util.HashSet;

import com.m1.tzolkin.model.TzolkinConstants;
import com.m1.tzolkin.model.board.ITechBoard;
import com.m1.tzolkin.model.exceptions.CannotBuildException;
import com.m1.tzolkin.model.exceptions.NoAvailableSkullException;
import com.m1.tzolkin.model.exceptions.NotEnoughCornException;
import com.m1.tzolkin.model.exceptions.NotEnoughResourceException;

public class Monument extends AbsActionBuildable implements IMonument, TzolkinConstants {
	
	// ATTRIBUTS
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 4647913279994335404L;
	private final MonumentTypes type;
	
	// CONSTRUCTEUR
	
	private Monument(MonumentTypes t) {
		super(t.getCost(), t.getType(), t.getAction());
		type = t;
	}
	
	// REQUETES
	
	public static Collection<IMonument> createAll() {
		Collection<IMonument> monuments = new HashSet<IMonument>();
		for (MonumentTypes t : MonumentTypes.values()) {
			monuments.add(new Monument(t));
		}
		return monuments;
	}
	
	@Override
	public String getName() {
		return type.name();
	}
	
	// COMMANDES

	@Override
	public void buy(ITechBoard b) throws NotEnoughCornException, NotEnoughResourceException, NoAvailableSkullException, CannotBuildException {
		b.build(this);
	}

}
